package com.tools;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

public class WebElementUtil {

    private static WebDriver driver;

    public WebElementUtil(WebDriver driver) {
        this.driver = driver;
    }

    public static WebElement findElementById(String elementId) {
        return  driver.findElement(By.id(elementId));
    }

    public static WebElement findElementByName(String elementName) {
        return driver.findElement(By.name(elementName));
    }

    public static WebElement findElementByClassName(String elementClassName) {
        return driver.findElement(By.className(elementClassName));
    }

    public static WebElement findElementByTagName(String elementTagName) {
        return driver.findElement(By.tagName(elementTagName));
    }

    public static WebElement findElementByLinkText(String linkText) {
        return driver.findElement(By.linkText(linkText));
    }

    public static WebElement findElementByPartialLinkText(String partialLinkText) {
        return driver.findElement(By.partialLinkText(partialLinkText));
    }

    public static WebElement findElementByCssSelector(String cssSelector) {
        return driver.findElement(By.cssSelector(cssSelector));
    }

    public static WebElement findElementByXpath(String xpathExpression) {
        return driver.findElement(By.xpath(xpathExpression));
    }
}
